package com.webdesign.action;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.webdesign.entity.TbAdmin;
import com.webdesign.entity.TbTeacher;
import com.webdesign.service.ITbAdminService;
import com.webdesign.service.ITbTeacherService;
import com.webdesign.util.MD5;


@Controller("RegisterAction")
@Scope("prototype")
public class RegisterAction extends ActionSupport{
	/*
	 * 教师注册*/
	private String userId;
	private String username;
	private String password;
	private String password2;
	private String email;
	private ITbTeacherService iTbTeacherService;
	private String flag;
	
	/*
	 * 教师注册*/
	public String teacherRegister()
	{
		MD5 getMD5 = new MD5();
        password=getMD5.GetMD5Code(password);
        boolean tbTeacher =iTbTeacherService.register(userId,username,password,email);
        if(tbTeacher)
        {
			flag="success";
        }
        else
        {
        	flag="wrong";
        }
        return SUCCESS;
	}
	
	public ITbTeacherService getiTbTeacherService() {
		return iTbTeacherService;
	}

	@Resource(name="TbTeacherService")
	public void setiTbTeacherService(ITbTeacherService iTbTeacherService) {
		this.iTbTeacherService = iTbTeacherService;
	}
	public String getUserId()
	{
		return userId;
	}
	public void setUserId(String userId){
		this.userId=userId;
	}
	
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
	public String getPassword2()
	{
		return password;
	}
	public void setPassword2(String password2){
		this.password2=password2;
	}
	
	public String getEmail(){
		return email;
	}
	public void setEmail(String email){
		this.email=email;
	}
	
	public String getFlag()
	{
		return flag;
	}
	public void setFlag(String flag)
	{
		this.flag=flag;
	}

}
